package com.lagou.edu.manager;

import com.lagou.edu.handler.AnnotationTransactionInvocationHandler;
import com.lagou.edu.utils.TransactionManager;
import net.sf.cglib.proxy.Proxy;


/**
 * @author HZF
 * @date 2020/5/31 10:39
 * @description
 */
public class TransactionEnabledAnnotationProxyManager {
    private TransactionManager transactionManager;
    public TransactionEnabledAnnotationProxyManager(TransactionManager transactionManager) {
        this.transactionManager = transactionManager;
    }
    public Object proxyFor(Object object) {
        return Proxy.newProxyInstance(object.getClass().getClassLoader(), object.getClass().getInterfaces(), new AnnotationTransactionInvocationHandler(object, transactionManager));
    }
}
